;--------------------------------------
;
; vrdChar.asm
;
; vrdChar(row,col)
;
; Byte row     row of char & attribute to read
; Byte col     column of char & attribute to read
;
; returns  screen character in al
;          screen attribute in ah
;

;--------------------------------------
;
; include defs, prototypes and macros
;

include tab6.inc

;--------------------------------------
;
; begin code segment
;

    .Code

vrdChar PROC Pascal PUBLIC USES es ds di si, prow:Byte, pcol:Byte

IF mdl eq 3    
    push   ds
    mov    ax,SEG scrn_seg
    mov    ds,ax
    mov    ax,ds:scrn_seg
    mov    es,ax
    pop    ds
ELSE
    mov    ax,scrn_seg
    mov    es,ax
ENDIF
    xor    ax,ax         ; 0 -> ax
    mov    al,prow       ; row -> al
    mov    bl,160        ; 80 chars wide * 2
    mul    bl            ; row * scrn width  -> ax
    mov    cl,pcol       ; column to cl
    xor    ch,ch         ; 0 -> ch
    shl    cx,1          ; col * 2
    add    ax,cx         ; column + (row * scrn width)
    mov    di,ax         ; point di to scrn
    mov    ax,es:[di]    ; attr -> ah, char -> al
    ret

vrdChar ENDP

    END
;
;--------------------------------------
    
    

